package com.msmall.erp.base.listener;

import java.io.InputStream;
import java.util.Properties;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.msmall.erp.base.Constant;

public class ConstantListener implements ServletContextListener {

	private static final Logger log = LoggerFactory.getLogger(ConstantListener.class);
	
	public void contextInitialized(ServletContextEvent arg0) {
		try{
			InputStream in = ConstantListener.class.getResourceAsStream("/constant.properties");
			Properties props = new Properties();
			props.load(in);
			
			Constant.SITE_DOMAIN = props.getProperty(Constant.SITE_DOMAIN_KEY);
			
			log.info(" ConstantListener : " + Constant.SITE_DOMAIN_KEY + "=" + Constant.SITE_DOMAIN
					+ "  ");
		}catch(Exception e){
			log.error("========>",e);
		}
	}
	
	public void contextDestroyed(ServletContextEvent arg0) {

	}

}
